/*
 * Ext GWT 2.2.5 - Ext for GWT
 * Copyright(c) 2007-2010, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */
package com.rattsoftware.server.util;

import java.util.ArrayList;
import java.util.List;

import com.rattsoftware.server.admin.model.Permission;
import com.rattsoftware.server.admin.model.Role;
import com.rattsoftware.server.admin.model.User;
import java.util.HashSet;

public class TestData {

	private static final String[] months = new String[] { "Jan", "Feb", "Mar",
		"Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };

	public static String[] getMonths() {
		return months;
	}

	public static String[] getShortMonths(int n) {
		String[] mths = new String[n];
		for (int c = 0; c < n; c++)
			mths[c] = months[c];
		return mths;
	}

	public static List<User> getUsers() {
		List<User> users = new ArrayList<User>();

		User user1 = new User();
		user1.setUsername("Frusher");
		user1.setEmail("ell86bu@gmail.com");
		user1.setLastName("Elly");
		user1.setFirstName("Businge");
		user1.setId(1+"");
		user1.setPhoneNumber("256782093837");
		user1.getRoles().add(getRole());

		User user2 = new User();
		user2.setUsername("Frusher2");
		user2.setEmail("ell86bu@gmail.com");
		user2.setLastName("Elly");
		user2.setFirstName("Businge");
		user2.setId(2+"");
		user2.setPhoneNumber("256782093838");

		User user3 = new User();
		user3.setUsername("Frusher3");
		user3.setEmail("ell86bu@gmail.com");
		user3.setLastName("Elly");
		user3.setFirstName("Businge");
		user3.setId(3+"");
		user3.setPhoneNumber("256782093837");

		users.add(user1);
		users.add(user2);
		users.add(user3);

		return users;
	}

	public static Role getRole() {
		
		Role role1 = new Role("ADMIN");
		role1.getPermissions().addAll(new HashSet<Permission>(getPermissions()));
		return role1;
	}
	
	public static List<Permission> getPermissions() {
		List<Permission> permissions = new ArrayList<Permission>();
		
		permissions.add(new Permission(Permission.PERM_ADD_ROLES));
		permissions.add(new Permission(Permission.PERM_ADD_USERS));
		permissions.add(new Permission(Permission.PERM_LIST_USERS));
		
		permissions.add(new Permission(Permission.PERM_DELETE_ROLES));
		permissions.add(new Permission(Permission.PERM_DELETE_USERS));
		permissions.add(new Permission(Permission.PERM_VIEW_ROLES));
		
		return permissions;
	}
}
